/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package app.model;

import com.app.game.bet.simple.BetRedBlack;
import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.control.ListCell;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.TextAlignment;

/**
 *
 * @author sammael
 */
public class HistoryCell extends ListCell<Integer> {
        @Override
        public void updateItem(Integer item, boolean empty) {
            super.updateItem(item, empty);
            
            if (item != null) {
                Label lbl = new Label(Integer.toString(item));
                lbl.setFont(Font.font("Rockwell Condensed", 20));
                VBox box = new VBox(0);
                if(BetRedBlack.black.contains(item)){
                    lbl.setTextFill(Color.BLACK);
                    lbl.setTextAlignment(TextAlignment.RIGHT);
                    box.setAlignment(Pos.CENTER_RIGHT);
                }else if(BetRedBlack.red.contains(item)){
                    lbl.setTextFill(Color.RED);
                    lbl.setTextAlignment(TextAlignment.LEFT);
                    box.setAlignment(Pos.CENTER_LEFT);
                }else{
                    lbl.setTextFill(Color.GREEN);
                    lbl.setTextAlignment(TextAlignment.CENTER);
                    box.setAlignment(Pos.CENTER);
                }
                box.getChildren().setAll(lbl);
                setGraphic(box);
            }
        }
    }
 
